//
//  BaseLabel.m
//  TakeYouTourTogether
//
//  Created by king on 15/11/26.
//  Copyright © 2015年 king. All rights reserved.
//

#import "BaseLabel.h"

@implementation BaseLabel

#pragma mark - Method initWithFrame:
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createLabel];
    }
    return self;
}
#pragma mark - Method createLabel
- (void)createLabel {
    self.backgroundColor = [UIColor clearColor];
    self.textColor = [self isDayOrNight];
    self.highlightedTextColor = [UIColor grayColor];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backValue:) name:@"test" object:nil];
}
#pragma mark - Method isDayOrNight
- (UIColor *)isDayOrNight {
    return [NightTimeModel shareNightTimeModel].isDayOrNight ? [UIColor blackColor] :[UIColor whiteColor];
}
#pragma mark - Method 通知中心
- (void)backValue:(NSNotification *)notification {
    BOOL b = [notification.userInfo[@"1"] boolValue];
    if (b) {
        [NightTimeModel shareNightTimeModel].isDayOrNight = NO;
        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"isDayOrNight"];
        self.textColor = [UIColor whiteColor];
    } else {
        [NightTimeModel shareNightTimeModel].isDayOrNight = YES;
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isDayOrNight"];
        self.textColor = [UIColor blackColor];
    }
}

@end
